/*
 ISpeLLController.h
 
 Created by cool8jay on 2/16/10.
 Copyright 2010 cool8jay@qq.com All rights reserved.
 */
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <WebKit/WebKit.h>
#import "RegexKitLite.h"
#import "Dict.cn.Style.h"
#import "SearchFieldWithTip.h"
#import "WordFinder.h"
#import "SpellFormatter.h"
#import "Constants.h"
#import "YRKSpinningProgressIndicator.h"

@class PreferenceController;

@interface ISpeLLController : NSObject {
	IBOutlet NSString *inputLetters;
	
	IBOutlet NSButton *lengthMatters;
	
	IBOutlet NSArrayController *wordsController;
	IBOutlet NSTableView *tableView;
	IBOutlet NSTextView *contentView;
	IBOutlet NSScrollView *scrollView;
	IBOutlet NSWindow *mainContentWindow;
	
	/*
	 Status item -- the little icon in the menu bar
	 */
    NSStatusItem *statusItem;
	
	/*
	 The menu attatched to status item
	 */
    IBOutlet NSMenu *statusBarMenu;
	
	IBOutlet SearchFieldWithTip *searchField;
	IBOutlet NSToolbarItem *spellOffToolbarItem;
	IBOutlet NSToolbar *spellToolbar;
	
	IBOutlet NSDrawer *resultDrawer;
	
	IBOutlet NSSlider *slider;
	IBOutlet NSTextField *minimumLimitLabel;
	IBOutlet NSTextField *resultLabel;
    
	IBOutlet WebView *webView;
	
	IBOutlet NSProgressIndicator *spellingProgressIndicator;
    
	NSMutableArray *resultWords;
	NSOperationQueue *finderQueue;
	
	/*
	 Singleton copy of English words list
	 */
	NSArray *dictionaryWords;
	
	NSString *trimmedInputLetters;
	
	IBOutlet NSView *view;
	IBOutlet NSTextField *modeTips;
	IBOutlet NSMenuItem *toggleAlwaysOnTopMenuItem;
	
	PreferenceController *preferenceController;
	
	int mode;
	
	IBOutlet NSBox *indicatorBox;
	IBOutlet YRKSpinningProgressIndicator *webLoadingProgressIndicator;
	
	IBOutlet NSButton *pinButton;
}

@property (readonly) NSArray *dictionaryWords;

@property (assign) NSProgressIndicator *spellingProgressIndicator;

@property (retain) NSWindow *mainContentWindow;
@property (retain) NSMenuItem *toggleAlwaysOnTopMenuItem;
@property (retain) NSMenu *statusBarMenu;
@property (retain) NSStatusItem *statusItem;
@property (retain) NSButton *pinButton;

- (IBAction)filterWords:(id)sender;
- (IBAction)foundWord:(NSString*)word;
- (IBAction)report:(id)sender;
- (IBAction)sortWords:(id)sender;
- (IBAction)handleInput:(id)sender;
- (IBAction)openHelp:(id)sender;

- (IBAction)showPreferencePanel:(id)sender;

- (IBAction)switchToSearch:(id)sender;
- (IBAction)switchToCross:(id)sender;
- (IBAction)switchToSpell:(id)sender;

- (IBAction)toggleAlwaysOnTop:(id)sender;

- (void)fillInContentView;
- (void)beforeSpell;

- (void)doSearch;
- (void)doSpell;
- (void)doCross;

- (BOOL)prepare;
- (void)removeWords;

@end
